#ifndef CAMSETTING_H
#define CAMSETTING_H

#include <pthread.h>
#include "udp.h"

typedef struct _CAM_SETTING CAM_SETTING;

typedef void (*UPDATEWND_FUNC)();

struct _CAM_SETTING
{
    short pos[4];       /* 三角当前位置,三角前1，后1，前2，后2 */
    int (*exec)(MH_UDP *pudp, int ctype, short *delta, short *find_zero);
    int (*reset)(MH_UDP * pudp, int ctype, short *find_zero);
    int (*set_zero_delta)(MH_UDP * pudp, char *delta);

    MH_UDP *pudp;
    UPDATEWND_FUNC update_wnd;
    pthread_t th_check;
    int timeout;
    int warn;
};

CAM_SETTING *cam_setting_new();
int cam_setting_set_zero_delta(CAM_SETTING *cam_setting, char *delta);
int cam_setting_exec(CAM_SETTING *cam_setting, int index, short pos);
int cam_setting_reset(CAM_SETTING *cam_setting);
void cam_setting_close(CAM_SETTING *cam_setting);
void cam_setting_set_update_window_func(CAM_SETTING *cam_setting, UPDATEWND_FUNC update_wnd);
int cam_setting_get_warn(CAM_SETTING *cam_setting);

#endif
